
<html><head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta content="text/javascript" http-equiv="content-script-type">
<title>system.threading.Atomic</title>
<link rel="stylesheet" type="text/css" href="candydoc/style.css">
<!--[if lt IE 7]><link rel="stylesheet" type="text/css" href="candydoc/ie56hack.css"><![endif]-->
<script language="JavaScript" src="candydoc/util.js" type="text/javascript"></script>
<script language="JavaScript" src="candydoc/tree.js" type="text/javascript"></script>
<script language="JavaScript" src="candydoc/explorer.js" type="text/javascript"></script>
</head><body>
<div id="tabarea"></div><div id="explorerclient"></div>
<div id="content"><script>explorer.initialize("system.threading.Atomic");</script>
	<table class="content">
		<tr><td id="docbody"><h1>system.threading.Atomic</h1><!-- Generated by Ddoc from F:\MyWork\phoenix\source\system\threading\Atomic.d -->
该模块定义了一些原子操作。
<br><br>
<b>License:</b><br>
BSD
<br><br>
<b>Authors:</b><br>
Lucifer (786325481@QQ.com)
<br><br>
<b>Copyright:</b><br>
Copyright (C) 2008 Lucifer. All rights reserved.
 
<br><br>

 The atomic module is intended to provide some basic support for lock-free
 concurrent programming.  Some common operations are defined, each of which
 may be performed using the specified memory barrier or a less granular
 barrier if the hardware does not support the version requested.  This
 model is based on a design by Alexander Terekhov as outlined in
 <a href=http://groups.google.com/groups?threadm=3E4820EE.6F408B25%40web.de>
 this thread</a>.  Another useful reference for memory ordering on modern
 architectures is <a href=http://www.linuxjournal.com/article/8211>this
 article by Paul McKenney</a>.

<br><br>
<b>License:</b><br>
BSD style: 
<br><br>
<b>Authors:</b><br>
Sean Kelly
 
<br><br>


<script>explorer.outline.incSymbolLevel();</script>
<dl>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">enum 
<span class="currsymbol">MemorySemantics</span>
<script>explorer.outline.addDecl('MemorySemantics');</script>

;
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Memory synchronization flag.  If the supplied option is not available on the
 current platform then a stronger method will be used instead.
 
<br><br>


<script>explorer.outline.incSymbolLevel();</script>
<dl>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">
<span class="currsymbol">Raw</span>
<script>explorer.outline.addDecl('Raw');</script>

</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>not sequenced
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">
<span class="currsymbol">HoistLoadBarrier</span>
<script>explorer.outline.addDecl('HoistLoadBarrier');</script>

</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>hoist-load barrier
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">
<span class="currsymbol">HoistStoreBarrier</span>
<script>explorer.outline.addDecl('HoistStoreBarrier');</script>

</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>hoist-store barrier
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">
<span class="currsymbol">SinkLoadBarrier</span>
<script>explorer.outline.addDecl('SinkLoadBarrier');</script>

</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>sink-load barrier
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">
<span class="currsymbol">SinkStoreBarrier</span>
<script>explorer.outline.addDecl('SinkStoreBarrier');</script>

</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>sink-store barrier
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">
<span class="currsymbol">Acquire</span>
<script>explorer.outline.addDecl('Acquire');</script>

</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>hoist-load + hoist-store barrier
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">
<span class="currsymbol">Release</span>
<script>explorer.outline.addDecl('Release');</script>

</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>sink-load + sink-store barrier
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">
<span class="currsymbol">FullFence</span>
<script>explorer.outline.addDecl('FullFence');</script>

</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>fully sequenced (acquire + release)
<br><br>

</dd>
</dl>
<script>explorer.outline.decSymbolLevel();</script>


</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">T 
<span class="currsymbol">atomicLoad</span>
<script>explorer.outline.addDecl('atomicLoad');</script>

(T, MemorySemantics ms = MemorySemantics.FullFence)(ref T <span class="funcparam">value</span>);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Supported MemorySemantics values:
 	MemorySemantics.Raw
  MemorySemantics.HoistLoadBarrier
  MemorySemantics.Acquire
  MemorySemantics.FullFence
 
<br><br>

 Refreshes the contents of 'value' from main memory.  This operation is
 both lock-free and atomic.
<br><br>
<b>Params:</b><br>
<table><tr>
<td nowrap valign="top" style="padding-right: 8px">value</td>

               
<td>The value to load.  This value must be properly aligned.</td></tr>
</table><br>
<b>Returns:</b><br>
The loaded value.
     
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">void 
<span class="currsymbol">atomicStore</span>
<script>explorer.outline.addDecl('atomicStore');</script>

(T, MemorySemantics ms = MemorySemantics.FullFence)(ref T <span class="funcparam">value</span>, T <span class="funcparam">newValue</span>);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Supported MemorySemantics values:
  MemorySemantics.Raw
  MemorySemantics.SinkStoreBarrier
  MemorySemantics.Acquire
  MemorySemantics.Release
  MemorySemantics.FullFence
 
<br><br>

 Stores 'newval' to the memory referenced by 'value'.  This operation
 is both lock-free and atomic.
<br><br>
<b>Params:</b><br>
<table><tr>
<td nowrap valign="top" style="padding-right: 8px">value</td>

               
<td>The destination variable.</td></tr>
<tr>
<td nowrap valign="top" style="padding-right: 8px">newValue</td>

               
<td>The value to store.</td></tr>
</table><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">bool 
<span class="currsymbol">atomicCAS</span>
<script>explorer.outline.addDecl('atomicCAS');</script>

(T, MemorySemantics ms = MemorySemantics.FullFence)(ref T <span class="funcparam">value</span>, T <span class="funcparam">newValue</span>, T <span class="funcparam">equalTo</span>);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Supported MemorySemantics values:
  MemorySemantics.Raw
  MemorySemantics.SinkStoreBarrier
  MemorySemantics.Acquire
  MemorySemantics.Release
  MemorySemantics.FullFence
 
<br><br>

 Stores 'newValue' to the memory referenced by 'value' if val is equal to
 'equalTo'.  This operation is both lock-free and atomic.
<br><br>
<b>Params:</b><br>
<table><tr>
<td nowrap valign="top" style="padding-right: 8px">value</td>

               
<td>The destination variable.</td></tr>
<tr>
<td nowrap valign="top" style="padding-right: 8px">newValue</td>

               
<td>The value to store.</td></tr>
<tr>
<td nowrap valign="top" style="padding-right: 8px">equalTo</td>

               
<td>The comparison value.</td></tr>
</table><br>
<b>Returns:</b><br>
<b>true</b> if the store occurred, <b>false</b> if not.
     
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">T 
<span class="currsymbol">atomicIncrement</span>
<script>explorer.outline.addDecl('atomicIncrement');</script>

(T, MemorySemantics ms = MemorySemantics.FullFence)(ref T <span class="funcparam">value</span>);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Supported MemorySemantics values:
  MemorySemantics.Raw
  MemorySemantics.SinkStoreBarrier
  MemorySemantics.Acquire
  MemorySemantics.Release
  MemorySemantics.FullFence
 
<br><br>

 This operation is only legal for built-in value and pointer types,
 and is equivalent to an atomic "value = value + 1" operation.  This
 function exists to facilitate use of the optimized increment
 instructions provided by some architecures.  If no such instruction
 exists on the target platform then the behavior will perform the
 operation using more traditional means.  This operation is both
 lock-free and atomic.
<br><br>
<b>Params:</b><br>
<table><tr>
<td nowrap valign="top" style="padding-right: 8px">value</td>

               
<td>The value to increment.</td></tr>
</table><br>
<b>Returns:</b><br>
The result of an atomicLoad of val immediately following the
  increment operation.  This value is not required to be equal to the
  newly stored value.  Thus, competing writes are allowed to occur
  between the increment and successive load operation.
     
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">T 
<span class="currsymbol">atomicDecrement</span>
<script>explorer.outline.addDecl('atomicDecrement');</script>

(T, MemorySemantics ms = MemorySemantics.FullFence)(ref T <span class="funcparam">value</span>);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Supported MemorySemantics values:
  MemorySemantics.Raw
  MemorySemantics.SinkStoreBarrier
  MemorySemantics.Acquire
  MemorySemantics.Release
  MemorySemantics.FullFence
 
<br><br>

 This operation is only legal for built-in value and pointer types,
 and is equivalent to an atomic "value = value - 1" operation.  This
 function exists to facilitate use of the optimized decrement
 instructions provided by some architecures.  If no such instruction
 exists on the target platform then the behavior will perform the
 operation using more traditional means.  This operation is both
 lock-free and atomic.
<br><br>
<b>Params:</b><br>
<table><tr>
<td nowrap valign="top" style="padding-right: 8px">value</td>

               
<td>The value to decrement.</td></tr>
</table><br>
<b>Returns:</b><br>
The result of an atomicLoad of val immediately following the
  increment operation.  This value is not required to be equal to the
  newly stored value.  Thus, competing writes are allowed to occur
  between the increment and successive load operation.
     
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">void 
<span class="currsymbol">atomicAdd</span>
<script>explorer.outline.addDecl('atomicAdd');</script>

(T, MemorySemantics ms = MemorySemantics.FullFence)(ref T <span class="funcparam">value</span>, T <span class="funcparam">newValue</span>);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>Supported MemorySemantics values:
  MemorySemantics.Raw
  MemorySemantics.SinkStoreBarrier
  MemorySemantics.Acquire
  MemorySemantics.Release
  MemorySemantics.FullFence
 
<br><br>

 Adds two integers and replaces the first integer with the sum, as an atomic operation.
     
<br><br>

</dd>
</dl>
<script>explorer.outline.decSymbolLevel();</script>


</td></tr>
		<tr><td id="docfooter">
			Page was generated with
			<img src="candydoc/img/candydoc.gif" style="vertical-align:middle; position:relative; top:-1px">
			on Sat Nov 29 22:33:13 2008

		</td></tr>
	</table>
</div>
<script>
	explorer.packageExplorer.addModule("platform.PAL");
	explorer.packageExplorer.addModule("platform.windows.Core");
	explorer.packageExplorer.addModule("platform.linux.Core");
	explorer.packageExplorer.addModule("system.Array");
	explorer.packageExplorer.addModule("system.BitArray");
	explorer.packageExplorer.addModule("system.Environment");
	explorer.packageExplorer.addModule("system.Event");
	explorer.packageExplorer.addModule("system.Exception");
	explorer.packageExplorer.addModule("system.Hash");
	explorer.packageExplorer.addModule("system.IntPtr");
	explorer.packageExplorer.addModule("system.Random");
	explorer.packageExplorer.addModule("system.Traits");
	explorer.packageExplorer.addModule("system.TypeTuple");
	explorer.packageExplorer.addModule("system.math.IEEE");
	explorer.packageExplorer.addModule("system.math.Math");
	explorer.packageExplorer.addModule("system.runtime.c.complex");
	explorer.packageExplorer.addModule("system.runtime.c.config");
	explorer.packageExplorer.addModule("system.runtime.c.ctype");
	explorer.packageExplorer.addModule("system.runtime.c.errno");
	explorer.packageExplorer.addModule("system.runtime.c.fenv");
	explorer.packageExplorer.addModule("system.runtime.c.inttypes");
	explorer.packageExplorer.addModule("system.runtime.c.limits");
	explorer.packageExplorer.addModule("system.runtime.c.locale");
	explorer.packageExplorer.addModule("system.runtime.c.math");
	explorer.packageExplorer.addModule("system.runtime.c.signal");
	explorer.packageExplorer.addModule("system.runtime.c.stdarg");
	explorer.packageExplorer.addModule("system.runtime.c.stddef");
	explorer.packageExplorer.addModule("system.runtime.c.stdint");
	explorer.packageExplorer.addModule("system.runtime.c.stdio");
	explorer.packageExplorer.addModule("system.runtime.c.stdlib");
	explorer.packageExplorer.addModule("system.runtime.c.string");
	explorer.packageExplorer.addModule("system.runtime.c.time");
	explorer.packageExplorer.addModule("system.runtime.c.wctype");
	explorer.packageExplorer.addModule("system.text.UTF");
	explorer.packageExplorer.addModule("system.threading.Atomic");
	explorer.packageExplorer.addModule("system.threading.ThreadUtility");
	explorer.packageExplorer.addModule("system.threading.synchronization.SpinWait");
	explorer.packageExplorer.addModule("system.collections.ArrayList");
	explorer.packageExplorer.addModule("system.collections.Comparer");
	explorer.packageExplorer.addModule("system.collections.Deque");
	explorer.packageExplorer.addModule("system.collections.EqualityComparer");
	explorer.packageExplorer.addModule("system.collections.Exception");
	explorer.packageExplorer.addModule("system.collections.HashMap");
	explorer.packageExplorer.addModule("system.collections.HashSet");
	explorer.packageExplorer.addModule("system.collections.ICollection");
	explorer.packageExplorer.addModule("system.collections.IComparer");
	explorer.packageExplorer.addModule("system.collections.IDeque");
	explorer.packageExplorer.addModule("system.collections.IEnumerable");
	explorer.packageExplorer.addModule("system.collections.IEnumerator");
	explorer.packageExplorer.addModule("system.collections.IEqualityComparer");
	explorer.packageExplorer.addModule("system.collections.IList");
	explorer.packageExplorer.addModule("system.collections.IMap");
	explorer.packageExplorer.addModule("system.collections.IQueue");
	explorer.packageExplorer.addModule("system.collections.LinkedList");
	explorer.packageExplorer.addModule("system.collections.Pair");
	explorer.packageExplorer.addModule("system.collections.PrimeHelper");
	explorer.packageExplorer.addModule("system.collections.PriorityQueue");
	explorer.packageExplorer.addModule("system.collections.Queue");
	explorer.packageExplorer.addModule("system.collections.RBTree");
	explorer.packageExplorer.addModule("system.collections.Stack");
	explorer.packageExplorer.addModule("system.collections.TreeMap");
	explorer.packageExplorer.addModule("system.collections.TreeSet");
	explorer.packageExplorer.addModule("system.collections.objectmodel.ListCollection");
	explorer.packageExplorer.addModule("system.collections.objectmodel.ReadOnlyListCollection");</script>
</body></html>


